{
    TFile *f = new TFile("amaevent_main_data_jtree.root");

    TTree *t = (TTree*)f->Get("Tree_JobInfo");

    /* Histograms for drawing */
    TH1F *h_job_etime = new TH1F("h_job_etime","",100,0.,100000.);
    TH1F *h_app_etime = new TH1F("h_app_etime","",100,0.,100000.);
    TH1D *h_no_events = new TH1F("h_no_events","",100,0,100000);

    Float_t min_job_etime = 999999999.;
    Float_t max_job_etime = 0.;

    Float_t min_app_etime = 999999999.;
    Float_t max_app_etime = 0.;

    Int_t min_no_events = 999999999;
    Int_t max_no_events = 0;

    Char_t bkend[8];
    Char_t status[16];
    Char_t cloud[8];
    Char_t ce[64];

    Float_t job_etime;
    Float_t app_etime;
    Int_t   no_events;

    t->SetBranchAddress("backend" , bkend);
    t->SetBranchAddress("status"  , status);
    t->SetBranchAddress("cloud"   , cloud);
    t->SetBranchAddress("ce"      , ce);

    t->SetBranchAddress("jobEtime", &job_etime);
    t->SetBranchAddress("appEtime", &app_etime);
    t->SetBranchAddress("noEvents", &no_events);

    Int_t nentries = (Int_t)t->GetEntries();

    for ( Int_t i=0; i<nentries; i++) {
        t->GetEntry(i);
        cout << "==> Entry " << i << endl;
        cout << "\tbackend   : " << bkend     << endl;
        cout << "\tstatus    : " << status    << endl;
        cout << "\tcloud     : " << cloud     << endl;
        cout << "\tce        : " << ce        << endl;
        cout << "\tjob_etime : " << job_etime << endl;
        cout << "\tapp_etime : " << app_etime << endl;
        cout << "\tno_events : " << no_events << endl;
        cout << ""   << endl;

        if ( job_etime < min_job_etime ) min_job_etime = job_etime;
        if ( app_etime < min_app_etime ) min_app_etime = app_etime;
        if ( no_events < min_no_events ) min_no_events = no_events;

        if ( job_etime > max_job_etime ) max_job_etime = job_etime;
        if ( app_etime > max_app_etime ) max_app_etime = app_etime;
        if ( no_events > max_no_events ) max_no_events = no_events;

        h_job_etime->Fill(job_etime);
        h_app_etime->Fill(app_etime);
        h_no_events->Fill(no_events);
    }

    // entities summary 
    cout << "==> Summary " << endl;
    cout << "\tjob_etime (min:max) : " << min_job_etime << " : " << max_job_etime << endl;
    cout << "\tapp_etime (min:max) : " << min_app_etime << " : " << max_app_etime << endl;
    cout << "\tno_events (min:max) : " << min_no_events << " : " << max_no_events << endl;

    TCanvas *c = new TCanvas("c","Job Statistics",0,0,800,600);
    c->Divide(2,2);

    c->cd(1);
    h_job_etime->GetXaxis()->Set(100, 0., max_job_etime);
    h_job_etime->SetFillColor(16);
    h_job_etime->Draw();

    c->cd(2);
    h_app_etime->GetXaxis()->Set(100, 0., max_app_etime);
    h_app_etime->SetFillColor(16);
    h_app_etime->Draw();
}
